Repository navigation
winegstreamer, mf, dxva2 and mfplat: the WM reader's compressed samples, a session that keeps its renderer, DXVA2 render targets, a discard copy - #78
Open
wenze-allen wants to merge 4 commits into
Conversation
…ialized. session_append_node() kept the HRESULT of IMFVideoSampleAllocator_InitializeSampleAllocator(), so an allocator that failed (the EVR's, when the device cannot create surfaces of the stream's format) failed the whole output node. session_collect_nodes() then stopped at that node, and the session ran with the renderer's node and every node after it missing. It still sent MESessionStarted, but no sample was ever requested, the remaining sinks never got the clock, and playback never ended. Release the allocator instead and keep the node. The upstream node then gets system memory samples, as it does for a renderer without an allocator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: allen <wenze532865208@gmail.com>
…streams when a reinit fails. SetReadStreamSamples is per stream, but reinit_stream() created the parser for compressed output from the last call's flag alone and enabled every stream with its compressed format then. It now creates a compressed-output parser when any stream reads compressed samples, and enables each stream with its own format: the compressed one, or the decoded one it has. When reinit_stream() failed (the parser refused to connect), it freed the reader's stream array but kept stream_count, and SetReadStreamSamples() returned S_OK anyway. The next call into the reader wrote through the NULL array: a KiriKiri movie plugin (krmovie.dll) that reads WMV as compressed samples crashed there, and the game stayed on a white screen. The streams belong to the open file, so a failed reinit now keeps them and drops only the handles into the destroyed parser. SetReadStreamSamples() goes back to the previous mode, rebuilds that parser and returns the failure. reinit_stream() tolerates being called with no parser, read thread or semaphore left, and returns an error rather than S_OK when it cannot wait for its read thread. free_streams() clears stream_count with the array. A parser that exposes a different number of streams with compressed output failed an assert, which aborts the process; it now fails the reinit, and the caller goes back to the previous parser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: allen <wenze532865208@gmail.com>
…ilter a scaled blit. IDirectXVideoProcessorService::CreateSurface() made every surface an offscreen plain surface, whatever its DXVA2 type, and VideoProcessBlt() stretches the samples into the target with StretchRect(). Native d3d9 does not stretch into a destination that is not a render target, and a strict implementation refuses it. The EVR mixer's targets are the size of the video window, not of the video: with DXMT's d3d9, VideoProcessBlt() left only its background fill, and a Media Foundation movie played as a black window (Senren Banka, a 1920x1080 WMV in a 2360x1328 window). wined3d is lenient, so it did not show there. DXVA2_VideoProcessorRenderTarget surfaces are now lockable render targets: the sample copier still writes frames into them, and the presenter's GetCurrentImage() reads them back with GetRenderTargetData(), which wants a render target. Native reports no usage for them, so the test's usage check is todo_wine. A blit that scales now uses D3DTEXF_LINEAR, as a video processor filters; a 1:1 copy stays D3DTEXF_POINT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: allen <wenze532865208@gmail.com>
…rwrites. ContiguousCopyFrom() on a D3D9 surface buffer locked the surface with no flags, so the surface was read back first, though every byte is then overwritten. The sample copier delivers each frame of a Media Foundation movie to the EVR this way. With DXMT's d3d9 the readback waits for the GPU: 9 to 12 ms per frame, 30 times a second, on the session's work queue thread, which also feeds the audio renderer; the audio ran short every few seconds (Senren Banka). The surface buffer now has its own ContiguousCopyFrom(), which locks with D3DLOCK_DISCARD. A plain write-only Lock2DSize() keeps the contents, as the tests show native does, and a buffer that is already locked takes the generic path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: allen <wenze532865208@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In short. Four commits on
madeira-lgpl(ddf92ba), a fast-forward. They are the Wine side of willfaust/Madeira#631 (Windows Media and Media Foundation movies on iOS), which pins this head,34765056b9e. One commit is on Sabbat of the Witch's path and was tested on a device. The other three are on Senren Banka's path, which has not been tested on a device yet.Details
b0d33cbd85a): the WM reader reads compressed samples per stream, and keeps its streams when a reinit fails.SetReadStreamSamplesis per stream, butreinit_stream()used the last call's flag for every stream. When the parser refused to connect, the reader freed its stream array but keptstream_count, andSetReadStreamSamples()still returnedS_OK. KiriKiri 2's movie plugin (krmovie.dll) reads a WMV as compressed samples. It then wrote through the NULL array and crashed, and Sabbat of the Witch stayed on a white screen. Now a failed reinit keeps the streams, goes back to the previous mode and parser, and returns the failure. A parser that exposes a different number of streams fails the reinit instead of hitting an assert.18689a08977): keep an output node whose sample allocator cannot be initialized. The failedInitializeSampleAllocator()HRESULT failed the whole node.session_collect_nodes()then stopped there, so the renderer's node and every node after it were missing. The session still sentMESessionStarted, but no sample was ever requested and playback never ended. Now the allocator is released and the node is kept; its upstream node gets system memory samples.1f0f5075e94): video processor render targets are created as render targets, and a scaled blit is filtered.CreateSurface()made every surface an offscreen plain surface. The EVR mixer's targets are the size of the window, not of the video. Native d3d9 and DXMT do notStretchRectinto a surface that is not a render target, so with DXMT,VideoProcessBlt()left only the background fill: Senren Banka's 1920x1080 WMV in a 2360x1328 window played as a black window. wined3d is lenient, so this did not show there.DXVA2_VideoProcessorRenderTargetsurfaces are now lockable render targets. Native reports no usage for them, so the test's usage check istodo_wine. A scaling blit usesD3DTEXF_LINEAR; a 1:1 copy staysD3DTEXF_POINT.34765056b9e):ContiguousCopyFrom()on a D3D9 surface buffer locks withD3DLOCK_DISCARD. It locked with no flags, so the surface was read back before every byte was overwritten. With DXMT, that readback waits for the GPU: 9 to 12 ms per frame, on the session's work queue thread, which also feeds the audio renderer. The audio ran short every few seconds. A plain write-onlyLock2DSize()keeps the contents, as the tests show native does.willfaust/Madeira#631 depends on this one (it pins this head), so merge this one first.
Validation
bef1e5d, built from my fork): Sabbat of the Witch's video CGs play. The path is KiriKiri 2'skrmovie→ WM sync reader with compressed samples → WMV/WMA decoder DMOs through the DMO wrapper → VMR9. Of these four commits, only the winegstreamer one is on that path. The tested build's wine (96d02552546) has the same tree asb0d33cbd85ahere, and it also contains the mf/session commit.[d9-drain] ... avg-us=9300) and by Windows Media movies: ASF/WMV files, the WMV decoder and resampler transforms, decode-ahead (Sabbat of the Witch, Senren Banka) Madeira#631's host checks.check-mf-video-render.pychecks this path from source against DXMT3d62913. The dxva2 and mfplat commits were not in any build that ran on a device.dlls/dxva2/tests/dxva2.ccompile cleanly (x86_64 PE,-fsyntax-only). Wine's own conformance tests were not run; that needs Windows.Written with Claude Code. Signed off (DCO), LGPL-2.1-or-later like the rest of the branch.
🤖 Generated with Claude Code